package com.ljm.boot.rabbitmq.comsumer;

import com.ljm.boot.rabbitmq.constant.*;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

/**
 * 消息接收者
 */
@Service
public class FanoutConsumer {

    //queues对应接收消息的队列
    @RabbitListener(queues = RabbitMQConstant.FANOUT_QUEUE_1)
    public void receive1(Object msg) {
        System.out.println("从 queue_fanout01 接收消息-" + msg);
    }

    @RabbitListener(queues = RabbitMQConstant.FANOUT_QUEUE_2)
    public void receive2(Object msg){
        System.out.println("从 queue_fanout02 接收消息-" + msg);
    }

}
